<template>
  <div class="u-p-20">
    <el-card shadow="never">
      <div slot="header">
        <span>
          <b class="u-f-16">用户余额日志</b>
        </span>
      </div>

      <el-table :data="tableData" class="u-mt-10" v-viewer>
        <el-table-column label="id" prop="id" width="60"></el-table-column>
        <el-table-column label="变动类型">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.type=='add'">充值增加</el-tag>
            <el-tag v-if="scope.row.type=='pay'" type="success">支付扣除</el-tag>
            <el-tag v-if="scope.row.type=='refund'" type="warning">退还增加</el-tag>
            <el-tag v-if="scope.row.type=='deduct'" type="danger">扣除余额</el-tag>
          </template>
        </el-table-column>
        <el-table-column label="上次金额" prop="last_price"></el-table-column>
        <el-table-column label="变动金额" prop="price"></el-table-column>
        <el-table-column label="说明" prop="detail"></el-table-column>
        <el-table-column label="添加时间" prop="add_date"></el-table-column>
      </el-table>

      <div class="u-mt-20 u-text-center">
        <el-pagination
          background
          @size-change="handleSizeChange"
          @current-change="handlePageChange"
          :current-page="currentPage"
          :page-sizes="[10, 20, 30, 40, 50]"
          :page-size="limit"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
        ></el-pagination>
      </div>
    </el-card>
  </div>
</template>

<script>
import commonPage from "@/mixins/common-page";
export default {
  mixins: [commonPage],
  props: {
    userId: {
      type: String
    }
  },
  data() {
    return {
      apiName: "user",
      apiPage: "balancePage", //方法
      queryForm: {
        user_id: this.userId
      }
    };
  },
  methods: {}
};
</script>
